<template>
  <div class="lpjyxjlBox">
    <!-------------------- 理坯机运行记录表 -------------------->
    <TableHeader
      :data="{
        mainTitle: '理坯机运行记录表',
        date: '2021年12月12日',
        company: '青岛崂山矿泉水有限公司',
        code: 'LK-QF-LS1-10-012-11-01',
      }"
    />
    <TableHeader
      :data="{
        subTitle: '瓶 坯 使 用 情 况',
      }"
    />
    <lb-table
      border
      :data="tableData1"
      highlight-current-row
    >
    </lb-table>
    <lb-table border :data="tableData2" :merge="['value0']">
    </lb-table>
    <!-- <RowColTable/> -->
  </div>
</template>

<script>
export default {
  data() {
    return {
      tableData1: {
        column: [
          {
            label: "序号",
            type: "index",
            align: "center",
          },
          {
            prop: "value0",
            label: "供应商及规格",
            align: "center",
            // fixed: true,
            // // width: '120',
            // renderHeader: (h, scope) => {
            //   return <span>{scope.column.label}</span>;
            // },
          },
          {
            label: "投坯时间",
            align: "center",
            prop: "value1",
          },
          {
            label: "数量（只）",
            align: "center",
            prop: "value2",
          },
          {
            label: "生产日期",
            align: "center",
            prop: "value3",
          },
          {
            prop: "value4",
            align: "center",
            label: "序号",
          },
          {
            prop: "value5",
            align: "center",
            label: "使用前检查情况",
            options: [
              {
                dictLabel: "正常",
                dictValue: "0",
              },
              {
                dictLabel: "停用",
                dictValue: "1",
              },
            ],
          },
          {
            prop: "value6",
            align: "center",
            label: "巡检确认",
          },
        ],
        data: [],
      },
      tableData2: {
        column: [
         {
            prop: "value0",
            label: "投坯总量",
            align: "center",
          },
          {
            prop: "value1",
            label: "不合格坯数量：",
            align: "center",
          },
          {
            label: "不合格原因：",
            align: "center",
            prop: "value2",
          },
        ],
        data: [],
      },
    };
  },
  created() {
    for (let i = 0; i < 4; i++) {
      this.tableData1.data.push({
        value0: "0",
        value1: 0,
        value2: "2",
        value3: "3",
        value4: "4",
        value5: 0,
        value6: 6,
      });
      this.tableData2.data.push({
        value0: 1345,
        value1: 213,
        value2: 213,
      });
    }
  },
  methods: {
    arraySpanMethod({ row, column, rowIndex, columnIndex }) {
      // console.log(row, column, rowIndex, columnIndex);
      if (rowIndex % 2 === 0) {
        if (columnIndex === 0) {
          // return [2, 2];
        }
      }
      // if (rowIndex === 0) {
      if (columnIndex <= 0) {
        return [1, 2];
      }
      // }
    },
    objectSpanMethod({ row, column, rowIndex, columnIndex }) {
      if (columnIndex === 0) {
        if (rowIndex % 2 === 0) {
          return {
            rowspan: 2,
            colspan: 1,
          };
        } else {
          return {
            rowspan: 0,
            colspan: 0,
          };
        }
      }
    },
  },
};
</script>

<style lang="scss" scoped>
.lpjyxjlBox {
  width: 100%;
  // background: red;
}
</style>>

